//
//  DataProcessing.h
//  KidReading
//
//  Created by telen on 14/12/8.
//  Copyright (c) 2014年 刘赞黄Telen. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "DataProcess.h"
#import "StoreKit/StoreKit.h"
@class TABLE_BOOKS;

@protocol DataProcessingAsyncSoudConvertFilesDelegate <NSObject>
@optional
- (void)DataProcessing_soudFilesAsyncConvertSuccess:(NSString*)ose toFiles:(NSString*)outFile;
- (void)DataProcessing_soudFilesAsyncConvertFailed:(NSString*)ose toFiles:(NSString*)outFile;

@end

@interface DataProcessing : DataProcess

@property(nonatomic,copy)NSString* book_cover_img_url;
@property(nonatomic,copy)NSString* bookshelf_icon_img_url;
@property(nonatomic,copy)NSString* banner_img_url;
@property(nonatomic,copy)NSString* book_zip_file_url;
@property(nonatomic,copy)NSString* support_file_url;
@property(nonatomic,copy)NSString* talk_file_url;
@property(nonatomic,copy)NSString* advert_img_url;
@property(nonatomic,copy)NSString* audio_file_url;
@property(nonatomic,copy)NSString* word_dict_url;
@property(nonatomic,copy)NSString* flowBook_host;
@property(nonatomic,copy)NSString* freval_data_host;
@property(nonatomic,copy)NSString* quiz_common_scripts_host;

@property(nonatomic,copy)NSString* quiz_url;
@property(nonatomic,copy)NSString* wordsDuyin_url;
@property(nonatomic,copy)NSString* wordsPeitu_url;
@property(nonatomic,copy)NSDate* dictExpiry_Date;
@property(nonatomic,assign)NSUInteger dictExpiry_Day;
@property(nonatomic,copy)NSString* avatar_host;

//
@property(nonatomic,copy)NSString* tempDirector;
@property(nonatomic,copy)NSString* zipDirector;
@property(nonatomic,copy)NSString* talksZipDirector;
@property(nonatomic,copy)NSString* booksDirector;
@property(nonatomic,copy)NSString* talksDirector;
@property(nonatomic,copy)NSString* talksVideoDirector;
@property(nonatomic,copy)NSString* wordsDictDirector;
@property(nonatomic,copy)NSString* wordsDictDirectorSound;
@property(nonatomic,copy)NSString* supportFilesDirector;
@property(nonatomic,copy)NSString* indexHtmlDirector;
@property(nonatomic,copy)NSString* quizDirector;
@property(nonatomic,copy)NSString* courseDirector;
//
@property(nonatomic,copy)NSString* booksDirectorLocalUrl;
//
@property(nonatomic,assign)float ratio_w;//上下通透，比例换算 短宽
@property(nonatomic,assign)float ratio_h;//上下通透，比例换算 长高
@property(nonatomic,assign)float ratio_hw;//当前设备的宽高比
//
@property(nonatomic,assign)float ratio_iPhone_w;//iphone适配比例
//声音播放加速减速
@property(nonatomic,assign)NSInteger soundPlayRatio_fast; //100+
@property(nonatomic,assign)NSInteger soundPlayRatio_slower; //-1到-99
//一个应用生命周期 不重复提醒无wifi
@property(nonatomic,assign)BOOL toContinueDown;

//单本购买产品参数
@property (nonatomic, assign) NSString * isRetailNow;
@property (nonatomic, strong) NSString *productCode;
@property (nonatomic, assign) double price;
@property (nonatomic, strong) NSNumber *productId;
@property (nonatomic, strong) NSNumber *bookOriginId;
@property (nonatomic, strong) TABLE_BOOKS *tbBook;

//状态栏状态
@property (nonatomic, assign) BOOL isStatusHidden;
//当前账户hurdleNumber
@property (nonatomic, assign) NSInteger hurdleNo;
@property (nonatomic, assign) NSInteger activityId;
@property (nonatomic, assign) BOOL souvenirExist;
//是否是外部提供路径
@property (nonatomic, assign) BOOL isOutPath;
@property (nonatomic, strong) NSString *outPath;
@property (nonatomic, copy) void(^pageChangedBlock)(NSInteger cPage);

+ (DataProcessing*)shareSingle;
@property(nonatomic,readonly)NSUInteger deviceType;
@property(nonatomic,readonly)BOOL canWindowRotation;

- (NSString*) machineName;
- (BOOL)isChineseForLocalSystem;
- (NSString*)language;

+ (NSString*)chooseLanguageFromCN:(NSString*)chinese andEN:(NSString*)english;//中英文选择
+ (NSString*)languageForfileName:(NSString*)name; //中英文 文件名

//获得完整的url 下载地址
+ (NSString*)full_BaseUrl:(NSString*)baseUrl url:(NSString*)url;//基本功能函数

+ (NSString*)fullBookZipFileUrl:(NSString*)url;
+ (NSString*)fullSupportFileUrl:(NSString*)url;
+ (NSString*)fullBookCoverImageUrl:(NSString*)url;
+ (NSString*)fullBookshelfIconImageUrl:(NSString*)url;
+ (NSString*)fullBannerImageUrl:(NSString*)url;
+ (NSString*)fullAdvert_img_url:(NSString*)url;

+ (NSString*)fullQuizUrl:(NSString*)url;
+ (NSString*)fullDuyinUrl:(NSString*)url;
+ (NSString*)fullPeituUrl:(NSString*)url;

+ (NSString*)fullTalkZipFileUrl:(NSString*)url;
+ (NSString*)fullTalkVideoFileUrl:(NSString*)url;

+ (NSString*)fullWordDictUrl:(NSString*)url;
+ (NSString*)fullWordDictUrl:(NSString*)url ContainMp3Path:(NSString*)path;
+ (NSString*)fullFlowBookHtmlUrl:(NSString*)url;
+ (NSString*)fullFrevalDataUrl:(NSString*)url;
+ (NSString*)fullQuizCommonScriptUrl:(NSString*)url;
//webSever
+ (NSString*)fullBookLocalHtmlWithBookId:(NSInteger)bookId;
//
//判断字典过去
+ (BOOL)isDictOutTime:(NSDate*)dateZ;

//获得本地存储地址
+ (NSString*)tempZipPathForBookID:(NSInteger)bookid urlPath:(NSString*)urlpath;//zip下载缓存文件地址 完整路径
+ (NSString*)storeZipPathForBookID:(NSInteger)bookid urlPath:(NSString*)urlpath;//zip下载完成地址 完整路径
+ (NSString*)storeZipPathForBookID:(NSInteger)bookid;//书的zip文件夹地址 路径
+ (NSString*)bookPathForBookID:(NSInteger)bookid;//书本解压后存放地址 路径
+ (NSString*)bookPathForBookID:(NSInteger)bookid subDir:(NSString*)name;//书本解压后存放地址 子目录
//
+ (NSString*)wordDictPathForBookID:(NSInteger)bookid;//每本书字典，完整路径
+ (NSString*)wordDictSoundPath;//字典，音频存放目录

//
+ (void)deleteBookFiles:(NSInteger)bookid;//删除书本zip和解压后文件 及相关目录
+ (void)deleteBooksFilesWithBookIDArr:(NSArray*)bookIdArr;//删除一组书
+ (void)deleteBookZips:(NSInteger)bookid;//仅仅删除zip包
+ (void)deleteQuizBookFiles:(NSInteger)originId bookId:(NSInteger)bookid;//删除quiz书本zip和解压后文件以及相关目录

+ (BOOL)unZipBookZipPath:(NSString*)path forBookid:(NSInteger)bookid;
/**解压quiz书本到quiz/course下*/
+ (BOOL)unZipQuizBookZipPath:(NSString*)path forBookOriginal:(NSInteger)OriginalId;

//读取书本根目录信息
+ (NSDictionary*)getBookJsonInfo:(NSInteger)bookid;
//读取书本语音评测的数据
+ (NSDictionary*)getEvaluatingJsonInfo:(NSInteger)bookId;
//自己的头像保存地址
+ (NSString*)avatarPathForSelf;
+ (NSString*)avatarRelativePathForSelf_onServer;

//针对书本字符分割取值
+ (NSArray*)getNumbersFromString:(NSString*)str;

//快慢SoundFile 路径转换
+ (NSString*)getFastSoudFilePathFromPath:(NSString*)ose;
+ (NSString*)getSlowerSoudFilePathFromPath:(NSString*)ose;

//通讯加密键值
+ (NSDictionary*)getSaltInfo;
+ (NSString*)passWord_enCode:(NSString*)code;
+ (NSString*)passWord_deCode:(NSString*)code;

//声音文件异步处理 带队列
- (void)regSoundDelegate:(id<DataProcessingAsyncSoudConvertFilesDelegate>) delegateSoundConvert;
- (void)unRegSoundDelegate:(id<DataProcessingAsyncSoudConvertFilesDelegate>) delegateSoundConvert;
- (void)soundFilesAsyncConvert:(NSString*)ose toFiles:(NSString*)outFile speedRatio:(NSInteger)speedRatio;

//处理内购
//+ (NSString*)getBuyUrl;
+ (BOOL)recordPaymentTransaction:(SKPaymentTransaction*) trans;
////
//- (void)payContinue;


//DateTime
+ (NSDate*)dateFromtimestamp:(long long)timestamp;
+ (long long)timestampFromNSDate:(NSDate*)date;
+ (long long)timestampFromNSDate_second:(NSDate*)date;
+ (long long)timestampFromNSDate_tilDayEnd:(NSDate *)date;
+ (NSDate*)dateFromNSDate_tilDayEnd:(NSDate *)date;
+ (long long)timestampFromtimestamp_tilDayEnd:(long long)timestamp;;

//

//SpaceTemp
+ (NSArray* )getDirArrForBooks;
+ (NSArray* )getDirArrForTalks;
+ (NSArray *)getDirArrForQuizBooks;
+ (NSArray *)getAudioDirArr;
+ (void)cleanDirArr:(NSArray*)pathArr;

//获取下载talkZip的地址
+ (NSString*)storeTalkZipPathForOriginalID:(NSInteger)originalid;
//获取zip解压后文件的地址
+ (NSString*)talkPathForOriginalID:(NSInteger)originalid;
//获取下载视频文件的地址
+ (NSString*)talkVideoPath;
//按照视频名称删除下载的视频文件
+ (void)deleteTalkVideoFiles:(NSString *)videoName;
//删除Talk解压后文件 及相关目录
+ (void)deleteTalkFiles:(NSInteger)originalid;
//仅仅删除zip包
+ (void)deleteTalkZips:(NSInteger)originalid;
//解压
+ (BOOL)unZipTalkZipPath:(NSString*)path forOriginalID:(NSInteger)originalid;
//按路径解压
+ (BOOL)unZipFromZipFilePath:(NSString*)path ToUnZipPath:(NSString*)UnzipPath;
//读取Talk根目录信息
+ (NSDictionary*)getTalkJsonInfo:(NSInteger)originalid;
//
//Talk 存储地址
+ (NSURL *)talkInterviewViewSavePath;
+ (NSURL *)talkInterviewViewSavePathForOriginalID:(NSInteger)oid;
+ (void)talkInterviewView_Delete_ForOriginalID:(NSInteger)oid;

//Quiz
//获取quiz/index/data template.html路径
+ (NSString *)getQuizPublicHtmlPath;
//获取quiz根目录信息
+ (NSDictionary*)getQuizJsonInfo:(NSInteger)bookId;
//获取图片
+ (UIImage*)getQuizImageWithFilePath:(NSString*)filePath BookID:(NSInteger)bookId;
//获取音频
+ (NSString*)getQuizVoiceWithComPath:(NSString*)filePath BookID:(NSInteger)bookId;
//
+ (NSString *)quizDataPathForBookOriginalID:(NSInteger)original;// quiz/index/data路径
//判断一个字符是否为全角数字
+ (BOOL)isFullWidthNumber:(NSString*)numberStr;

//SDW含有默认头像的方法
+(void)SDW_setImageContainDefaultAvatarWithURL:(NSURL*)url View:(UIView*)view Gender:(NSInteger)gender;

//imageWithContentsOfFile简便方法
+ (UIImage *)contentFileImageWithName:(NSString *)imgName type:(NSString *)type;

//获取用户底部toolBar
+ (NSArray *)rootToolBarData;
@end
